﻿using Microsoft.EntityFrameworkCore;
using Prism.Ioc;
using Prism.Regions;
using Prism.Unity;
using SmartParing.IService;
using SmartParking.Base;
using SmartParking.IService;
using SmartParking.ORM;
using SmartParking.Service;
using SmartParking.Views;
using System.Configuration;
using System.Data;
using System.Windows;

namespace SmartParking
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainView>();
        }
        protected override void InitializeShell(Window shell)
        {
            base.InitializeShell(shell);
            //默认显示一个页面
            Container.Resolve<IRegionManager>().RegisterViewWithRegion("MainRegion", "DashboardView");

        }
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterDialog<LoginView>();
            containerRegistry.RegisterDialogWindow<DialogWindowEx>();

            containerRegistry.RegisterSingleton<DbContext, SmartParkingDbContext>();
            containerRegistry.Register<IUserService, UserService>();
            containerRegistry.Register<IMenuService, MenuService>();
            containerRegistry.Register<IRoleService, RoleService>();
            containerRegistry.Register<IDeviceService, DeviceService>();
            containerRegistry.Register<IAutoService, AutoService>();
            containerRegistry.Register<IRechargeService, RechargeSerivce>();
            containerRegistry.Register<IRecordService, RecordService>();
            containerRegistry.Register<IPayService, PayService>();
            containerRegistry.Register<IReportService, ReportService>();


            containerRegistry.RegisterForNavigation<Views.Pages.DashboardView>();
            containerRegistry.RegisterForNavigation<Views.Pages.MenuManagementView>();
            containerRegistry.RegisterForNavigation<Views.Pages.UserManagementView>();
            containerRegistry.RegisterForNavigation<Views.Pages.RoleView>();
            containerRegistry.RegisterForNavigation<Views.Pages.DeviceView>();
            containerRegistry.RegisterForNavigation<Views.Pages.AutoView>();
            containerRegistry.RegisterForNavigation<Views.Pages.RechargeView>();
            containerRegistry.RegisterForNavigation<Views.Pages.MonitorView>();
            containerRegistry.RegisterForNavigation<Views.Pages.ReportView>();


            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyMenuView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyUserView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyPasswordView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyRoleView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.SelectUserView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.SelectRoleView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyDeviceView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyAutoView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyRechargeView>();
            containerRegistry.RegisterDialog<Views.Pages.Dialogs.PrintView>();
        }
    }

}
